﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.EmphasizeContinuousMfg.CUiECMSelectWidthDlg
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.ComponentModel;
using System.Windows.Forms;
using Tecnomatix.Engineering.Ui;


namespace DnProcessSimulateCommands.EmphasizeContinuousMfg;

public class CUiECMSelectWidthDlg : TxForm
{
  private CUiECMEmphasizeContinuousMfgDlg m_parent;
  private double m_selectedWidth = 1.0;
  private IContainer components;
  private TxNumericEditBoxCtrl m_widthControl;
  private Label m_lblWidth;
  private Label m_lblPixels;
  private Button m_btnApply;
  private Button m_btnCancel;
  private Button m_btnOk;

  public double SelectedWidth
  {
    get => this.m_selectedWidth;
    set => this.m_selectedWidth = value;
  }

  public CUiECMSelectWidthDlg(CUiECMEmphasizeContinuousMfgDlg parent)
  {
    this.InitializeComponent();
    this.m_parent = parent;
  }

  public CUiECMSelectWidthDlg(double defaultWidthValue, CUiECMEmphasizeContinuousMfgDlg parent)
  {
    this.InitializeComponent();
    if (defaultWidthValue > 0.0)
    {
      this.m_widthControl.Value = defaultWidthValue;
      this.SelectedWidth = defaultWidthValue;
    }
    this.m_parent = parent;
  }

  private void m_btnCancel_Click(object sender, EventArgs e) => ((Form) this).Close();

  private void m_btnApply_Click(object sender, EventArgs e) => this.ApplySelectedWidth();

  private void m_btnOk_Click(object sender, EventArgs e)
  {
    this.ApplySelectedWidth();
    ((Form) this).Close();
  }

  private void ApplySelectedWidth()
  {
    this.SelectedWidth = this.m_widthControl.Value;
    if (this.m_parent != null)
    {
      double selectedWidth = this.SelectedWidth;
      if (this.SelectedWidth > 0.0)
        this.m_parent.EmphasizeSelectedMfgsWidth(Convert.ToInt32(this.SelectedWidth));
    }
    this.m_btnCancel.DialogResult = DialogResult.OK;
  }

  protected virtual void Dispose(bool disposing)
  {
    if (disposing && this.components != null)
      this.components.Dispose();
    base.Dispose(disposing);
  }

  private void InitializeComponent()
  {
    ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof (CUiECMSelectWidthDlg));
    this.m_widthControl = new TxNumericEditBoxCtrl();
    this.m_lblWidth = new Label();
    this.m_lblPixels = new Label();
    this.m_btnApply = new Button();
    this.m_btnCancel = new Button();
    this.m_btnOk = new Button();
    ((Control) this).SuspendLayout();
    this.m_widthControl.BorderStyle = BorderStyle.FixedSingle;
    componentResourceManager.ApplyResources((object) this.m_widthControl, "m_widthControl");
    this.m_widthControl.LowerBound = 1.0;
    ((Control) this.m_widthControl).Name = "m_widthControl";
    this.m_widthControl.ReadOnly = false;
    this.m_widthControl.StepSize = 1.0;
    this.m_widthControl.TextAlign = HorizontalAlignment.Left;
    this.m_widthControl.ThousandsSeparator = false;
    this.m_widthControl.UpperBound = 20.0;
    this.m_widthControl.Value = 0.0;
    this.m_widthControl.ValueType = (TxNumericEditValueType) 3;
    componentResourceManager.ApplyResources((object) this.m_lblWidth, "m_lblWidth");
    this.m_lblWidth.Name = "m_lblWidth";
    componentResourceManager.ApplyResources((object) this.m_lblPixels, "m_lblPixels");
    this.m_lblPixels.Name = "m_lblPixels";
    componentResourceManager.ApplyResources((object) this.m_btnApply, "m_btnApply");
    this.m_btnApply.Name = "m_btnApply";
    this.m_btnApply.UseVisualStyleBackColor = true;
    this.m_btnApply.Click += new EventHandler(this.m_btnApply_Click);
    componentResourceManager.ApplyResources((object) this.m_btnCancel, "m_btnCancel");
    this.m_btnCancel.DialogResult = DialogResult.Cancel;
    this.m_btnCancel.Name = "m_btnCancel";
    this.m_btnCancel.UseVisualStyleBackColor = true;
    this.m_btnCancel.Click += new EventHandler(this.m_btnCancel_Click);
    componentResourceManager.ApplyResources((object) this.m_btnOk, "m_btnOk");
    this.m_btnOk.DialogResult = DialogResult.OK;
    this.m_btnOk.Name = "m_btnOk";
    this.m_btnOk.UseVisualStyleBackColor = true;
    this.m_btnOk.Click += new EventHandler(this.m_btnOk_Click);
    componentResourceManager.ApplyResources((object) this, "$this");
    ((ContainerControl) this).AutoScaleMode = AutoScaleMode.Font;
    ((Control) this).Controls.Add((Control) this.m_btnOk);
    ((Control) this).Controls.Add((Control) this.m_btnCancel);
    ((Control) this).Controls.Add((Control) this.m_btnApply);
    ((Control) this).Controls.Add((Control) this.m_lblPixels);
    ((Control) this).Controls.Add((Control) this.m_lblWidth);
    ((Control) this).Controls.Add((Control) this.m_widthControl);
    ((Form) this).FormBorderStyle = FormBorderStyle.FixedToolWindow;
    ((Form) this).MaximizeBox = false;
    ((Form) this).MinimizeBox = false;
    ((Control) this).Name = nameof (CUiECMSelectWidthDlg);
    ((Form) this).ShowInTaskbar = false;
    ((Control) this).ResumeLayout(false);
    ((Control) this).PerformLayout();
  }
}
